package kr.co.graviti.adm.main.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
 
import kr.co.graviti.common.action.BaseFuncAction;

public class AdmMainAction extends BaseFuncAction{
	
	private static final Logger _log = Logger.getLogger(AdmMainAction.class);
	public ActionForward admmain(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,HttpServletResponse response)
	        throws Exception {
		
		HttpSession session = request.getSession();
		_log.info("=====>"+session.getAttribute("admId"));
		_log.info("=====>"+session.getAttribute("admNm"));
		_log.info("=====>"+session.getAttribute("lang"));
		
		return mapping.findForward("admmain");
	}
	
	public ActionForward logout(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,HttpServletResponse response)
	        throws Exception {
		
		System.out.println("======================== Logout");
		HttpSession session = request.getSession();
		session.removeAttribute("admId");
		session.removeAttribute("admNm");
		session.removeAttribute("lang");
		
		session.removeAttribute("topmenulength");
		session.removeAttribute("topmenu");
		
		_log.info("=====>"+session.getAttribute("admId"));
		_log.info("=====>"+session.getAttribute("admNm"));
		_log.info("=====>"+session.getAttribute("lang"));
		
		
		return mapping.findForward("logout");
	}
}
